s_hsSkyBrightness

Creating scenes and oi by sweeping out the skymap brightness.
This takes us from day to night levels. It is used to create a GIF for presentations, showing how the reduction in the sky brightness changes the overall sensor illuminance.
The scenes have with different amounts of sky light, but otherwise the same.
The irradiance axis levels (scale on the right) are set by a function at the end.
(Once the files are all written out, I used Powerpoint to make them into a gif)
See also

Get the scenes

ieInit;
imageID = '1112201236'; % - Good one
lgt = {'headlights','streetlights','otherlights','skymap'};
destPath = fullfile(isethdrsensorRootPath,'data',imageID);
 
scenes = cell(numel(lgt,1));
for ll = 1:numel(lgt)
thisFile = sprintf('%s_%s.exr',imageID,lgt{ll});
destFile = fullfile(destPath,thisFile);
if ~exist(destFile,"file")
ieWebGet('resourcetype','isethdrsensor',...
'resource name',fullfile('data',imageID,thisFile),...
'download dir',isethdrsensorRootPath);
end
scenes{ll} = piEXR2ISET(destFile);
end

Create the optics with some flare

[oi,wvf] = oiCreate('wvf');
params = wvfApertureP;
 
% We should implement wvfApertureSet/Get so we do not have to remember
% the parameter names precisely.
params.nsides = 3;
params.dotmean = 50;
params.dotsd = 20;
params.dotopacity =0.5;
params.dotradius = 5;
params.linemean = 50;
params.linesd = 20;
params.lineopacity = 0.5;
params.linewidth = 2;
 
aperture = wvfAperture(wvf,params);

Loop through the scene skymap levels

% headlights, street lights, other lights, sky map
% wgts = [0.0124 0.0011 0.0010 2.396];
 
wgts = [0.0124 5*0.0011 3*0.0010 100*2.396];
sf = 0.25;
cnt = 1;
for ii=1:7
fprintf('Scene %d, wgts(4) %f\n',ii, wgts(4));
 
combinedScene = sceneAdd(scenes, wgts);
combinedScene = piAIdenoise(combinedScene);
 
% Denoising takes some time.
% scene = hsSceneCreate(imageID,'weights',wgts,'denoise',true);
 
% [scene,wgts] = hsSceneCreate(imageID,'dynamic range',10^5,'low light',10,'denoise',true);
oi = oiCompute(oi, combinedScene,'aperture',aperture,'crop',true, 'pixel size',3e-6);
% For visibility
oiWindow(oi);
if ii < 4, oi = oiSet(oi,'gamma',0.7);
else, oi = oiSet(oi,'gamma',0.3);
end
 
oiPlot(oi,'illuminance hline rgb',[1 564]);
drawnow;
 
setAxisAndWrite(cnt);
cnt = cnt + 1;
wgts(4) = wgts(4)*sf;
end
Scene 1, wgts(4) 239.600000
Denoised in: 16.763
Scene 2, wgts(4) 59.900000
Denoised in: 17.688
Scene 3, wgts(4) 14.975000
Denoised in: 16.870
Scene 4, wgts(4) 3.743750
Denoised in: 17.543
Scene 5, wgts(4) 0.935937
Denoised in: 17.445
Scene 6, wgts(4) 0.233984
Denoised in: 17.538
Scene 7, wgts(4) 0.058496
Denoised in: 17.691

-----------------------------------------

function setAxisAndWrite(cnt)
% Set up the axis
 
ax = gca; yyaxis right
ax.YAxis(2).Limits = [10^-4,10^4];
n = 7; yTick = logspace(-3,3,n);
yTick = yTick(1:2:n); % Space by 2 log units
set(ax,'ytick',yTick);
 
fname = sprintf('test-%d.png',cnt);
fname = fullfile(isethdrsensorRootPath,'local',fname);
exportgraphics(ax,fname);
 
end